<template>
	<view class="safe-area-inset-bottom">
		<view class="swip_header">
			<view class="slot-box">
				<view style="width: 100%;">
					<uni-search-bar v-model="queryParams.params.findApi" type="text" @confirm="handleQuery"
						@input="handleQuery" placeholder="请输入退款编号或名称" />
				</view>
			</view>
		</view>

		<!-- 交易明细列表 -->
		<view class="listSearchTop" v-if="refundList != ''">
			<view v-for="item,index in refundList" :key="index">
				<view class="add-find-box card-border">
					<view class="flex_between">
					<p class="grid-integral">余额退款编号：{{ item.number }}</p>
					<!-- 退款状态 -->
					  <uni-tag text="退款失败" type="warning"></uni-tag>
					</view>
					<p class="grid-integral">订单支付类型：
					<span v-if="item.payType == $order.ec_order_pay_type.accountBalance">账户余额</span>
					<span v-if="item.payType == $order.ec_order_pay_type.carbonEnergy">碳能量兑换</span>
					<span v-if="item.payType == $order.ec_order_pay_type.systemGift">系统赠送</span>
					</p>
					<p class="grid-integral">原充值订单编号：{{ item.number }}</p>
					<p class="grid-integral">退款金额：
						<span v-if="item.payType == 1" > {{ item.amount }}g碳能量</span>
						<span v-else> {{ item.amount }}元</span>
					</p>
					<p class="grid-integral">退款渠道：
						<span v-if="item.channel == $order.ec_trading_channel.accountBalance">账户余额</span>
						<span v-if="item.channel == $order.ec_trading_channel.zhifubao">支付宝</span>
						<span v-if="item.channel == $order.ec_trading_channel.wechat">微信</span>
						<span v-if="item.channel == $order.ec_trading_channel.bank">银行卡</span>
					</p>
					<p class="grid-integral">退款人名称：{{ item.name }}</p>
					<p class="grid-integral">退款到账账号：{{ item.number }}</p>
					<p class="grid-integral">申请时间：{{item.payTime}}</p>
					<!-- <view class="flex_between"> -->
						<p class="grid-integral">审核时间：{{item.createTime}}</p>
						<!-- <button size="mini" @click="detail(item)" class="white_btn">查看详情</button> -->
					<!-- </view> -->
				</view>
			</view>
		</view>

		<!-- 暂无数据 -->
		<luanqingEmpty :show="true" text="没有更多数据啦" v-else />
	</view>
</template>

<script>
	import luanqingEmpty from '@/components/luanqing-empty/luanqing-empty';
	import {addDateRange} from "@/utils/ruoyi"
	export default {
		components: {
			luanqingEmpty
		},
		data() {
			return {
				name: '',
				refundList: [],
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					inOutType: null,
					channel: null,
					params: {
						findApi: undefined
					}
				},
				// 日期范围
				dateRange: [],
			}
		},
		onLoad() {
			// this.getList();
		},
		methods: {
			/** 余额明细列表查询 */
			getList() {
        this.$modal.loading();
				listOrderPay(addDateRange(this.queryParams, this.dateRange)).then(response => {
					uni.hideLoading()
					this.refundList = response.rows;
				});
			},
			/** 查看详情 */
			// detail(item) {
			// 	uni.navigateTo({
			// 		url: './orderDetail?signFlowFeeOrder=' + JSON.stringify(item)
			// 	})
			// },
			/** 搜索按钮操作 */
			handleQuery() {
				this.getList();
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: $uni-bg-color-grey;
	}
</style>
